#include <iostream>
#include <vector>
using namespace std;

class Solution 
{
public:
    static void generate(int numRows)
    {
        vector<vector<int>> vv;
        vv.resize(numRows);

        for (int i = 0; i < numRows; i++)
        {
            vv[i].resize(i + 1);
            vv[i].front() = 1;
            vv[i].back() = 1;

            for (int j = 1; j < i; j++)
            {
                vv[i][j] = vv[i - 1][j] + vv[i - 1][j - 1];
            }
        }

        for (auto &v : vv)
        {
            for (auto e : v)
            {
                cout << e << " ";
            }
            cout << endl;
        }
       
    }
};

int main()
{

    Solution::generate(5);
    

    return 0;
}